﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Base;
using nspJob;

public partial class Job_ChangePwd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.Cookies["uName"] == null)
                Response.Write("<script>location.assign('Index.aspx');</script>");
        }
    }

    /// <summary>
    /// depiction：该方法用于修改密码
    /// </summary>
    ///Create Date：2009-9-4
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            RUser ru = new RUser();
            TUser tu = new TUser();
            tu.LoginName = Request.Cookies["uName"].Value;
            if (!Request.Cookies["uPwd"].Value.ToString().Equals(this.txtPassword.Value))
            {
                lblmsg.Text = "请输入正确密码";
                return;
            }
            if (!this.txtPassword1.Value.Equals(this.txtPassword2.Value))
            {
                lblmsg.Text = "两次密码不一致！";
                return;
            }
            tu.password = this.txtPassword1.Value;
            int count = ru.Update(tu);
            if (count > 0)
            {
                this.pnlSucess.Visible = true;
                Response.Write("<script>location.assign('ResumeManager.aspx');</script>");
            }
        }
        catch
        {
            this.pnlSucess.Visible = true;
            this.pnlSucess.InnerHtml = "修改失败";
        }

    }
    protected void BtnCancle_Click(object sender, EventArgs e)
    {
        this.txtPassword.Value = "";
        this.txtPassword1.Value = "";
        this.txtPassword2.Value = "";
    }
}
